#ifndef DEVICE_H
#define DEVICE_H

#include "Config/Export.h"
#include "Utilities/Singleton.h"
#include "Core/Renderer.h"
#include "Core/EventManager.h"
#include "Core/ResourceManager.h"
#include "Core/MediaManager.h"
#include "Maths/TVector2.h"
#include <string>

namespace blue {

class SHARED Device : public Singleton<Device>
{
    MAKE_SINGLETON(Device)

    public:

        void init(int width = 800, int height = 600, bool fullscreen = false);

        Vector2i getSize();

        void resize(int width, int height, bool effective = true);
        void setWindowPos(int x, int y);

        void sleep(double time);

        bool setFullScreen(bool fullscreen);
        bool isFullScreen() const;

        void setWindowTitle(const std::string title, bool giveFPS = false);

        void setMousePos(int x, int y);
        void showCursor(bool show);

        bool run() const;
        void closeDevice();

        Renderer *getRenderer() const;
        EventManager *getEventManager() const;
        ResourceManager *getResourceManager() const;
        MediaManager *getMediaManager() const;

    private:

        Vector2i _size;
        bool _fullscreen;
        bool _run;
        std::string _title;
        int _FPS;
        double _current_time, _fps_timer;
};

}

#endif
